package OrederManagement.util;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

public class PropertyManager {
	
	private static PropertyManager instance =null;
	
	Properties prop =new Properties();
	private PropertyManager(){
		try {
			prop.load(new FileInputStream("jdbc.management"));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	public  static synchronized PropertyManager getInstance(){
		if(instance ==null){
			instance =new PropertyManager();
		}
		return instance;
	}
	public String getProperty(String key){
		 if(prop.getProperty(key)==null){
			 prop.put(key, new String (""));
		 }
		 return prop.getProperty(key);
	}
	
	public String[] getPropertyList(String key){
		if(prop.getProperty(key)==null){
			prop.put(key, new String (""));
		}
		return prop.getProperty(key).split(",");
	}
	

}
